package demo01;

/**
 * Created by ztt on 2017/9/24.
 */

/**
 * execution( * demo01.bean.Performance.perform(..))
 * execution:方法执行时调用
 * *：表示任意的返回类型
 * demo01.bean.Performance：方法所属的类
 * perform：方法
 *( ..)：表示任意的参数
 * 注：支持连接操作（&&表示and、||表示or、!表示not)
 */

import demo01.bean.Performance01Bean;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * 还可以通过bean的id来限制
 * execution( * demo01.bean.Performance.perform(..)) and bean('woodstock')
 *
 * execution( * demo01.bean.Performance.perform(..)) and !bean('woodstock')
 */

public class PerformanceMain {

    public static void main(String[] args) {

        ApplicationContext context = new ClassPathXmlApplicationContext("demo01/aop.xml");
        Performance01Bean perform = (Performance01Bean) context.getBean("performance");
        perform.perform();
    }
}
